package com.example.demo.controller;

import com.example.demo.utils.MyRequestBody;
import com.example.demo.utils.MyResponseBody;
import com.example.demo.utils.RequestData;
import com.example.demo.utils.ResponseData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created by reasahi on 2017/6/28.
 */
@Controller
@RequestMapping("/test")
public class TestController {

    @RequestMapping(value = "/index", method = {RequestMethod.POST}, produces = "text/plain;charset=UTF-8")
    @MyResponseBody
    public ResponseData test(@MyRequestBody RequestData requestData) {
        System.out.println("json参数："+requestData.getParam());
        ResponseData responseData = new ResponseData(requestData.getParam().toString());
        return responseData;
    }

}
